#*************************************************************************
#*
#*  $RCSfile$
#*
#*  $Revision$
#*
#*  last change: $Author: wiede $ $Date: 2005-10-19 17:46:51 +0200 (Wed, 19 Oct 2005) $
#*
#*  The Contents of this file are made available subject to the terms of
#*  the following license
#*
#* 	- BSD License
#*
#*	see file license/license.terms in this directory
#*
#*  Copyright 2005 Wolfgang Grosser
#*
#*  Author: Wolfgang Grosser
#*
#*  Contributor(s): 
#*
#************************************************************************/

package require tcluno_soffice
namespace eval ::tcluno::simpress {
}
proc ::tcluno::simpress::createShape {document shapeType rectangle} {
	set factory [$document queryInterface [$document ::tcluno::getTclunoType {TypeClass com.sun.star.lang.XMultiServiceFactory INTERFACE}]]
	set xObj [$factory createInstance $shapeType]
	set point [tcluno_soffice::createPoint [concat [lrange $rectangle 0 1] [lindex $rectangle 4]]]
#	set point [$tcluno_soffice::desktop tcluno::createUnoStructHelper com.sun.star.awt.Point [lrange $rectangle 0 1]]
	set size [tcluno_soffice::createSize [lrange $rectangle 2 4]]
#	set size [$tcluno_soffice::desktop tcluno::createUnoStructHelper com.sun.star.awt.Size [lrange $rectangle 2 3]]
	set xShape [$xObj queryInterface [$xObj ::tcluno::getTclunoType {TypeClass com.sun.star.drawing.XShape INTERFACE}]]
	$xShape setPosition $point
	$xShape setSize $size
	return $xShape
}
proc ::tcluno::simpress::setText {document page rectangle text {shapeType com.sun.star.drawing.TextShape}} {
	set xShape [createShape $document $shapeType $rectangle]
#	puts stderr [join [tcluno_soffice::getPropertyValues $xShape] "\n"]

	$page add $xShape

	set xText [$xShape queryInterface [$xShape ::tcluno::getTclunoType {TypeClass com.sun.star.text.XText INTERFACE}]]
	$xText setString $text
#	puts stderr [join [tcluno_soffice::getPropertyValues $xText] "\n"]
	return $xText
}

package provide tcluno_simpress 0.0
